package cn.chengdu.service.impl;

import cn.chengdu.entity.People;
import cn.chengdu.mapper.PeopleMapper;
import cn.chengdu.service.IPeopleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 病人表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-11-13
 */


@Service
public class PeopleServiceImpl extends ServiceImpl<PeopleMapper, People> implements IPeopleService {
    @Autowired
    private PeopleMapper peopleMapper;


    /**
     * 添加用户方法
     * @param people
     * @return
     */

    @Override
    public boolean insterOne(People people) {

        if(peopleMapper.insert(people)>=1) {
            return true;
        }

        return false;
    }


    @Override
    public boolean selectByidCard(String idcard,String tel) {

        QueryWrapper<People> qw = new QueryWrapper<>();

        qw.eq("pcode",idcard);
     qw.eq("pphone",tel);

        if(peopleMapper.selectOne(qw)!=null) {
            return true;
        }


        return false;
    }
// 注册
    @Override
    public int register(People people) {

        return peopleMapper.register(people);
    }
//登录
    @Override
    public People login(People people) {
        return peopleMapper.login(people);
    }
}
